package cz.muni.fi.pa165.travelagency.persistence;

import cz.muni.fi.pa165.travelagency.entities.Order;
import java.util.List;

/**
 * Interface for DAO of orders
 *
 * @author Marián Mozola
 * @version 1.0
 */
public interface IOrderDAO {

    /**
     * Creates an order and save it to database
     *
     * @param order
     * @throws IllegalArgumentException if order is null
     * @throws IllegalStateException if id of order is incorrect
     * @throws IllegalStateException if date of creation is incorrect
     * @throws IllegalStateException if customer is null
     * @throws IllegalStateException if number of persons are lesser than 1
     * @throws IllegalStateException if ordered tours or package tours are null
     * @throws IllegalStateException if price is null or lesser than zero
     */
    public void createOrder(Order order) throws IllegalArgumentException, IllegalStateException;

    /**
     * Deletes an order from database
     *
     * @param order
     * @throws IllegalArgumentException if order is null
     * @throws IllegalStateException if id of the order is null or incorrect
     */
    public void deleteOrder(Order order) throws IllegalArgumentException, IllegalStateException;

    /**
     * Finds and returns all orders from database
     *
     * @return all orders
     */
    public List<Order> findAll();
    
    /**		
     * Finds and returns all unpaid orders		
     *		
     * @return all unpaid orders		
     */		
    public List<Order> findUnpaid();

    /**
     * Returns single order with given id
     *
     * @param id id of desired order
     * @throws IllegalArgumentException if order is null or negative number
     */
    public Order getOrder(Long id) throws IllegalArgumentException;

    /**
     * Updates given order in to the memory
     *
     * @param order order to update
     * @throws IllegalArgumentException if order is null
     * @throws IllegalStateException if id of order is incorrect
     * @throws IllegalStateException if date of creation is incorrect
     * @throws IllegalStateException if customer is null
     * @throws IllegalStateException if number of persons are lesser than 1
     * @throws IllegalStateException if ordered tours or package tours are null
     * @throws IllegalStateException if price is null or lesser than zero
     */
    public void updateOrder(Order order) throws IllegalArgumentException, IllegalStateException;
}